<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>返回所有已定义函数的数组</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.function-exists.html">« function_exists</a></li>
      <li style="float: right;"><a href="function.register-shutdown-function.html">register_shutdown_function »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.funchand.html">函数处理 函数</a></li>
    <li>返回所有已定义函数的数组</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.get-defined-functions" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">get_defined_functions</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">get_defined_functions</span> &mdash; <span class="dc-title">返回所有已定义函数的数组</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.get-defined-functions-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>get_defined_functions</strong></span>(<span class="methodparam"><span class="type">bool</span> <code class="parameter">$exclude_disabled</code><span class="initializer"> = <strong><code>true</code></strong></span></span>): <span class="type">array</span></div>

  <p class="para rdfs-comment">
   获取所有已定义函数的数组。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.get-defined-functions-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">exclude_disabled</code></dt>

    <dd>

     <p class="para">
      禁用的函数是否应该在返回的数据里排除。
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.get-defined-functions-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回数组，包含了所有已定义的函数，包括内置/用户定义的函数。可通过 <var class="varname">$arr["internal"]</var>
   来访问系统内置函数，通过 <var class="varname">$arr["user"]</var> 来访问用户自定义函数（参见示例）。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.get-defined-functions-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">exclude_disabled</code> 参数的默认值从 <strong><code>false</code></strong> 更改为 <strong><code>true</code></strong>。
      </td>
     </tr>

     <tr>
      <td>7.0.15, 7.1.1</td>
      <td>
       新增 <code class="parameter">exclude_disabled</code> 参数。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.get-defined-functions-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5089">
    <p><strong>示例 #1 <span class="function"><strong>get_defined_functions()</strong></span> 例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">myrow</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$data</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #DD0000">"&lt;tr&gt;&lt;th&gt;</span><span style="color: #0000BB">$id</span><span style="color: #DD0000">&lt;/th&gt;&lt;td&gt;</span><span style="color: #0000BB">$data</span><span style="color: #DD0000">&lt;/td&gt;&lt;/tr&gt;\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">$arr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">get_defined_functions</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$arr</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [internal] =&gt; Array
        (
            [0] =&gt; zend_version
            [1] =&gt; func_num_args
            [2] =&gt; func_get_arg
            [3] =&gt; func_get_args
            [4] =&gt; strlen
            [5] =&gt; strcmp
            [6] =&gt; strncmp
            ...
            [750] =&gt; bcscale
            [751] =&gt; bccomp
        )

    [user] =&gt; Array
        (
            [0] =&gt; myrow
        )

)
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.get-defined-functions-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.function-exists.html" class="function" rel="rdfs-seeAlso">function_exists()</a> - 如果给定的函数已经被定义就返回 true</span></li>
    <li class="member"><span class="function"><a href="function.get-defined-vars.html" class="function" rel="rdfs-seeAlso">get_defined_vars()</a> - 返回由所有已定义变量所组成的数组</span></li>
    <li class="member"><span class="function"><a href="function.get-defined-constants.html" class="function" rel="rdfs-seeAlso">get_defined_constants()</a> - 返回所有常量的关联数组，键是常量名，值是常量值</span></li>
    <li class="member"><span class="function"><a href="function.get-declared-classes.html" class="function" rel="rdfs-seeAlso">get_declared_classes()</a> - 返回由已定义类的名字所组成的数组</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>